package com.czkt.controller;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendMessageController {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @RequestMapping("/sendMessage")
    public Object sendMessage(String message){
        rabbitTemplate.send("simple.luoliang",new Message(message.getBytes()));
        return "成功";
    }
}
